#ifndef __FLASH_LOG_H__
#define __FLASH_LOG_H__
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "flashUser.h"
#include "commInterface.h"

#ifdef __cplusplus
 extern "C" {
#endif

#define LOG_FLASH_HEADER_MAGIC      0x5AA5
#define LOG_FLAG_EMTPY              0xFFFFFFFF
#define LOG_FLAG_CLEAR              0x00000001

#define LOG_FLASH_PRINT_MAX         (BUF_LOG_ITEM_SIZE - 20) 
#define LOG_FLASH_HEADER_LEN        8
#define LOG_FLASH_DATA_LENGTH       (CMBACKTRACE_SIZE-12)
typedef struct 
{
    uint16_t magic;
    uint16_t length;
    uint32_t check_sum;
    uint8_t data[LOG_FLASH_DATA_LENGTH];
    uint32_t flag;
}LogFlashData_st;

int8_t log_flash_print(const char* ps8Format, ...);
int8_t log_flash_store(void);
int8_t log_flash_recover(void);
int8_t log_flash_clear(void);
LogFlashData_st *log_flash_get(void);

#ifdef __cplusplus
}
#endif

#endif
